Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

213
Vistas
"ERROR db._checkNotDeleted is not a function" when trying to update my database

I'm trying to make simple sign-in function for my web using firebase however I'm getting an error saying: ERROR db._checkNotDeleted is not a function

my Firebase versions is 9 and React is running on 17.0.2.

This is my firebase config file snippet (Will hide configurations since its unnecessary):

import { initializeApp } from "firebase/app";
import { getAuth, signInWithPopup, GoogleAuthProvider } from "firebase/auth";
import { getDatabase, ref, set } from "firebase/database";
import { getFirestore, doc, getDoc, collection, addDoc, getDocs, query, where} from "firebase/firestore";



const firebaseConfig = {
  */*/*/*/
};

const app = initializeApp(firebaseConfig);


export const auth = getAuth(app);

  export const createUserProfileDocument = async (userAuth, additionalData) => {
    if(!userAuth) return;

    const docRef = doc(db, "users", `${userAuth.uid}`);
    
    const docSnap = await getDoc(docRef);

    if (!docSnap.exists()) {
      const { displayName, email } = userAuth;
      const createdAt = new Date();
    
     
      try {
        await set(ref(db, 'users/' + `${userAuth.uid}`), {
          displayName: "TEST"
        })
        console.log("HERE");
       
      } catch (error) {
        console.log("ERROR", error.message);
      }
    }
    return docRef;
  }

  
  

  const provider = new GoogleAuthProvider();

  export const signInWithGoogle = () => {
      signInWithPopup(auth, provider)
      .then((result) => {
            console.log(result);
      }).catch((error) => {
          console.log(error);
      })
  }
 
  
  
  const db = getFirestore();

Here is my project: https://github.com/poolpy111/oto-clothing/tree/master/src

In debugger error line appears on line 43 which is where I use firebase's "ref" method. What I'm supposed to do?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Firebase has two databases namely Firebase Realtime Database and Cloud Firestore. In the provided code you are creating a DocumentReference by using doc() but then using set() imported from Realtime Database SDK which is causing the error.

If you want to add data in Firestore then import setDoc() from Firestore and refactor the code as shown below:

import { initializeApp } from "firebase/app";
import { getAuth, signInWithPopup, GoogleAuthProvider } from "firebase/auth";
import { getFirestore, doc, getDoc, setDoc, collection, addDoc, getDocs, query, where} from "firebase/firestore";

export const createUserProfileDocument = async (userAuth, additionalData) => {
  if(!userAuth) return;

  const docRef = doc(db, "users", `${userAuth.uid}`);
    
  const docSnap = await getDoc(docRef);

  if (!docSnap.exists()) {
    const { displayName, email } = userAuth;
    const createdAt = new Date();  
     
    try {
      // use setDoc()
      await setDoc(docRef, {
        displayName: "TEST"
      })
      console.log("HERE");   
    } catch (error) {
      console.log("ERROR", error.message);
    }
  }
  return docRef;
}

Follow Firestore's documentation for more information.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda